<template>
	<view class="datailsBox">
		<Login></Login>
		<view class="searchpage" style="padding: 66rpx 38rpx 0 40rpx; box-sizing: border-box">
			<div style="display: flex">
				<div style="
		    width: 36px;
		    height: 25px;
		    font-size: 18px;
		    font-family: PingFang SC;
		    font-weight: bold;
		    line-height: 26px;
		    color: #000000;
		    opacity: 0.7;
		  ">
					搜索
				</div>
				<div style="text-align: right; flex: 1">
					<text class="text1">删除</text>
					<text class="text2">返回箱子</text>
				</div>
			</div>
			<view class="" style="display: flex">
				<view class="weui-cells weui-cell_input" style="margin-top: 64rpx; display: flex">
					<input class="weui-input" auto-focus placeholder="搜索" style="padding-left: 20rpx" />
				</view>
				<button class="mini-btn" type="primary" size="mini" @click="getGoodsList">
					搜索
				</button>
			</view>
			<!-- 收纳箱详情 -->
			<view class="" v-for="(item,index) in goodsList" :key="index" style="width: 670rpx;box-sizing: border-box; padding-top: 42rpx; display: flex; ">
				<view class="datailsBox-footer" style="margin-right: 10rpx; font-size: 28rpx;display: flex;" @click="storageDetail(item)">
					<view >{{item.goodsName}}</view>
					<view>{{item.goodsIntroduce}}</view>
					<!-- <view>个人</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import Login from "../../common/login/login.vue"
	import BaseUrl from "../../utlis/api.js"
	export default {
		components: {
			Login
		},
		data() {
			return {
				dataList: [],
				userId:'',
				boxId:'',
				goodsList:[]
			}
		},
		onLoad(e) {
		this.boxId=e.boxId
		console.log(this.boxId)
		this.getGoodsList()
			// this.getDataList()
		},
		methods: {
			getGoodsList() {
				console.log("listBox")
			},
			storageDetail(data) {
				// console.log(data)
				const params = data;
				uni.navigateTo({
					url: '/pages/storageDetails/storageDetails?params=' + JSON.stringify(params),
				})
			},
			// getDataList() {
			// 	const token = wx.getStorageSync('token') || [];
			// 	const userId = wx.getStorageSync('userId');
			// 	uni.request({
			// 		url: BaseUrl + "wx/sbox/box/list?uesrId=" + userId,
			// 		method: 'GET',
			// 		header: {
			// 			"Authorization": "Bearer " + token,
			// 		},
			// 		success: (res) => {
			// 			this.dataList = res.data.rows
			// 			console.log(this.dataList)
			// 		}
			// 	})
			// },
			getGoodsList(){
				const boxId=this.boxId
				// console.log(boxId)
				if (wx.getStorageSync("userInfo")) {
					const token = wx.getStorageSync('token') || [];
					uni.request({
						url: BaseUrl+"/wx/sbox/goods/list",
						method: 'GET',
						header: {
							"Authorization": "Bearer " + token,
						},
						data:{boxId:boxId},
						success: (res) => {
							this.goodsList=res.data.rows
							console.log(this.goodsList)
						}
					})
				}
			},
		}
	}
</script>

<style>
	.datailsBox {
		width: 100%;
		height: 100%;
		background-color: #c3b18b;
	}

	.searchpage {
		width: 100%;
		height: 100%;
		background-color: #f9f7f2;
		border-radius: 20rpx;
	}

	.text1 {
		width: 24px;
		height: 17px;
		font-size: 12px;
		font-family: PingFang SC;
		font-weight: bold;
		line-height: 26px;
		color: #000000;
		opacity: 0.6;
		margin-right: 20rpx;
	}

	.text2 {
		width: 48px;
		height: 17px;
		font-size: 12px;
		font-family: PingFang SC;
		font-weight: bold;
		line-height: 26px;
		color: #000000;
		opacity: 0.6;
	}

	.weui-cells {
		display: inline-block;
		width: 254px;
		height: 32px;
		border: 1px solid #000;
		opacity: 0.3;
		border-radius: 10px;
	}

	.mini-btn {
		width: 61px;
		height: 32px;
		margin-top: 70rpx;
		background: #ffcf00;
		opacity: 1;
		border-radius: 10px;
	}

	.whitebg {
		whitebgwidth: 120px;
		height: 40px;
		background: #fff;
		opacity: 0.9;
		border-radius: 10px;
		font-weight: 800;
		line-height: 52rpx;
		color: #000000;
		font-size: 24rpx;
		box-sizing: border-box;
		padding: 15rpx;
	}

	.datailsBox-footer {
		width: 100%;
		display: flex;
		justify-content: space-between;
		margin-top: 42rpx;
	}
</style>
